<?php
/**
 * 基类控制器
 * @Author    紫梦
 * @DateTime  2017-12-20
 * @copyright 响响租车
 * @version   1.0
 */
namespace app\wxapp\controller;
use think\Controller;
use think\Request;
class Base extends Controller
{

    /**
     * 初始化验证登录相关信息
     */
    public function _initialize()
	{
		//开启url session
		ini_set('session.use_only_cookies', 0);
		ini_set('session.use_trans_sid', 1);
	    if(empty(session('admin.id'))){
	    	
        	$this->error('请先登录','login',['url'=>'login']);
        	
	    	
	    }else{
	    	// $this->success('请先登录',url('wxapp/Login/login'));
	    }
	}

	/**
	 * 验证权限
	 */
	static function juris()
	{
		$request = Request::instance();
		$action = $request->action();
		$controller =  strtolower($request->controller());

		 return in_array($controller.'/'.$action, session('admin.nodes')); 
		
	}


}
